package com.study.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.study.dao.UserDao;
import com.study.pojo.User;
import com.study.service.UserService;

@Service
public class UserServiceImpl implements UserService {
	@Autowired
	private UserDao userDao;

	@Override
	public List<User> getUserList() {
		List<User> userList= userDao.getUserList();
		return userList;
	}
        //测试事务
	@Override
	public int addUser(User user) {
		System.out.println("----111----test-tx----------------");
		int j = userDao.deleteUser(58);
			
		System.out.println("---222-----test-tx----------------");
		int i = userDao.addUser(user);
		System.out.println("---333-----test-tx----------------");	
			
		return 5;
	}

	@Override
	public int deleteUser(int id) {
		int i = userDao.deleteUser(id);
		return i;
	}

	@Override
	public int updateUser(int id) {
		int i = userDao.updateUser(id);
		return i;
	}
}
